package com.example.librarymanagement.service.impl;

import com.example.librarymanagement.mapper.AdminMapper;
import com.example.librarymanagement.model.Admin;
import com.example.librarymanagement.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AdminServiceImpl implements AdminService {

    private final AdminMapper adminMapper;

    @Autowired
    public AdminServiceImpl(AdminMapper adminMapper) {
        this.adminMapper = adminMapper;
    }

    @Override
    public Admin authenticateAdmin(Admin adminCredentials) {
        return adminMapper.findAdminByNameAndPassword(adminCredentials.getAdminName(), adminCredentials.getPassword());
    }
}